//
//  SZZCViewController.m
//  Vpay
//
//  Created by 伟大大 on 2018/9/20.
//  Copyright © 2018年 丁伟佳. All rights reserved.
//

#import "SZZCViewController.h"
#import "NewWebViewController.h"
@interface SZZCViewController ()
{
    UIButton *rightNavBtn;
}

@end

@implementation SZZCViewController

#pragma mark -
#pragma mark - for lifeCircle
#pragma mark -
- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    rightNavBtn.hidden = NO;
    //    [self.navigationController setNavigationBarHidden:YES animated:animated];
    
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    rightNavBtn.hidden = YES;
    //    [self.navigationController setNavigationBarHidden:NO animated:animated];
    
    //    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    //    self.view.backgroundColor = BACKCOLOR;
    
    //    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    //    [self.navigationController setNavigationBarHidden:NO animated:NO];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"数字资产";
    self.view = [[[NSBundle mainBundle]loadNibNamed:@"SZZCViewController" owner:self options:nil]lastObject];
    self.view.backgroundColor = BACKCOLOR;
    
    
    
    [self initData];
    [self initNavBtns];
    [self initViews];
    
    //    [NSThread detachNewThreadSelector:@selector(requestData) toTarget:self withObject:nil];
    
    //    [NSThread detachNewThreadSelector:@selector(requestDingdanData) toTarget:self withObject:nil];
}
#pragma mark -
#pragma mark - for data
#pragma mark -
- (void)initData {
}
#pragma mark -
#pragma mark - for Views
#pragma mark -

- (void)initNavBtns {
    
    rightNavBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightNavBtn setFrame:CGRectMake1(243-4, 9, 80, 20)];
    //    rightNavBtn.imageEdgeInsets = UIEdgeInsetsMake(5, 10, 0, 0);
    [rightNavBtn setTitle:NSLocalizedString(@"jyjl", nil) forState:UIControlStateNormal];
    
    rightNavBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [rightNavBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [rightNavBtn addTarget:self action:@selector(rightNavBtnClicked) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationController.navigationBar addSubview:rightNavBtn];
    self.navigationItem.leftBarButtonItem = [AppUtility getNavBtnItemLefBacktWith:@selector(leftNavBtnClicked) andTarget:self];
}

- (void)initViews {
    
    NSURLRequest *request =[NSURLRequest  requestWithURL:[NSURL URLWithString:@"http://vpay1.luck8868.com/Turntable/index.html?isApp=1"]] ;
    [_mywebView loadRequest:request];
    
    self.TopView.backgroundColor = BLUECOLOR;
    
    [self.Out_btn setTitle:NSLocalizedString(@"szzczc", nil) forState:UIControlStateNormal];
    [self.Zhongchou_btn setTitle:NSLocalizedString(@"zhongchou", nil) forState:UIControlStateNormal];
//    [self.Vb_btn setTitle:NSLocalizedString(@"szzczc", nil) forState:UIControlStateNormal];
    [self.TB_btn setTitle:NSLocalizedString(@"szzctb", nil) forState:UIControlStateNormal];
    
    self.Price_label.text = [NSString stringWithFormat:@"%@:62.3571",NSLocalizedString(@"currentprice", nil)];

    self.Copy_btn.layer.cornerRadius = 4.5;
    self.Copy_btn.layer.borderWidth = 1.0;
    self.Copy_btn.layer.borderColor = RGBCOLOR(215, 41, 41).CGColor;
    self.Out_btn.imageEdgeInsets = UIEdgeInsetsMake(0, 13, 18.5, 13);
    self.Out_btn.titleEdgeInsets = UIEdgeInsetsMake(38, -35, 0, 0);
    
    self.Zhongchou_btn.imageEdgeInsets = UIEdgeInsetsMake(0, 13, 18.5, 13);
    self.Zhongchou_btn.titleEdgeInsets = UIEdgeInsetsMake(38, -38, 0, 0);
    
    self.Vb_btn.imageEdgeInsets = UIEdgeInsetsMake(0, 13, 18.5, 13);
    self.Vb_btn.titleEdgeInsets = UIEdgeInsetsMake(38, -36, 0, 0);
    
    self.TB_btn.imageEdgeInsets = UIEdgeInsetsMake(0, 13, 18.5, 13);
    self.TB_btn.titleEdgeInsets = UIEdgeInsetsMake(38, -40, 0, 0);
    
    
    self.MyTableView.scrollEnabled = NO;
    self.MyTableView.showsVerticalScrollIndicator = NO;
    self.MyTableView.showsHorizontalScrollIndicator = NO;
    self.MyTableView.delegate = self;
    self.MyTableView.dataSource = self;
    self.MyTableView.rowHeight = 61*theApp.autoSizeScaleY;
    self.MyTableView.backgroundColor = BACKCOLOR;
    self.MyTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    self.MyTableView.frame = CGRectMake(0, self.MyTableView.frame.origin.y, self.MyTableView.frame.size.width, self.MyTableView.rowHeight*6+42*theApp.autoSizeScaleY);
    
    self.myScrollView.contentSize = CGSizeMake(0, self.MyTableView.frame.origin.y+self.MyTableView.frame.size.height);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)dealloc {
    [_Price_label release];
    [_SC_label release];
    [_Pay_address_label release];
    [_Copy_btn release];
    [_Out_btn release];
    [_Zhongchou_btn release];
    [_Vb_btn release];
    [_TB_btn release];
    [_MyTableView release];
    [_TopView release];
    [_myScrollView release];
    [_mywebView release];
    [super dealloc];
}
#pragma mark -
#pragma mark for delegates
#pragma mark -
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 6;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSMutableDictionary *dic = [self.array objectAtIndex:indexPath.row] ;
    UITableViewCell *cell = nil;
    SZZCTableViewCell *cell1 = [self.MyTableView dequeueReusableCellWithIdentifier:@"SZZCTableViewCell"];
    if (!cell1)
    {
        cell1 = [[SZZCTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SZZCTableViewCell"];
        cell1.delegate = self;
    }
    cell1.selectionStyle = NO;
    [cell1 SetCellInfo:dic];
    
    cell = cell1;
    
    return cell;
}
#pragma mark -
#pragma mark for evevts
#pragma mark -

-(void)choseTerm:(UIButton *)button withid:(NSString *)oid {
    
    if (button.tag == 10) {
        
        
    }else if (button.tag == 11){
        
        NewWebViewController *vc = [[NewWebViewController alloc]init];
        vc.LXtitle = @"余额交易";
        vc.urlStr = @"http://vpay1.luck8868.com/Turntable/Transaction/cid/1.html";
        [self.navigationController pushViewController:vc animated:YES];
    }
    
}
- (void)leftNavBtnClicked {
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)rightNavBtnClicked {
    LXWebViewController *vc = [[LXWebViewController alloc]init];
    vc.LXtitle = @"交易记录";
    vc.urlStr = @"http://vpay1.luck8868.com/Turntable/Trans.html?isApp=1";
    [self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)Copy_btnClik:(UIButton *)sender {
}
- (IBAction)Out_btnClik:(UIButton *)sender {
}
- (IBAction)Zhongchou_btnClik:(UIButton *)sender {
}
- (IBAction)Vb_btnClik:(UIButton *)sender {
}
- (IBAction)TB_btnClik:(UIButton *)sender {
}
@end
